home *** CD-ROM | disk | FTP | other *** search
- import java.util.Random;
-
- class Roger$AnimationCanvas$BallsEngine {
- // $FF: renamed from: w int
- int field_0;
- // $FF: renamed from: h int
- int field_1;
- long count;
- Location[] vec;
- Random random;
- // $FF: synthetic field
- private final Roger$AnimationCanvas this$1;
-
- Roger$AnimationCanvas$BallsEngine(Roger$AnimationCanvas this$1) {
- this.this$1 = this$1;
- this.random = new Random();
- this.vec = new Location[4];
- }
-
- void init(int w, int h) {
- this.count = 0L;
- this.field_1 = h;
- this.field_0 = w;
- this.vec[0] = new Location(0, 0);
- this.vec[1] = new Location(10, -20);
- this.vec[2] = new Location(30, -h);
- this.vec[3] = new Location(40, -2 * h / 3);
- }
-
- void tick() {
- ++this.count;
-
- for(int i = 0; i < this.vec.length; ++i) {
- this.vec[i].tick();
- }
-
- for(int i = 0; i < this.vec.length; ++i) {
- if (this.vec[i].y > this.field_1) {
- Location temp = new Location();
-
- do {
- temp.x = Math.abs(this.random.nextInt() % (this.field_0 - 10));
- temp.y = -1 * Math.abs(this.random.nextInt() % (this.field_1 - 10));
- } while(!this.method_0(temp));
-
- this.vec[i] = temp;
- }
- }
-
- }
-
- // $FF: renamed from: ok (Location) boolean
- boolean method_0(Location temp) {
- for(int i = 0; i < this.vec.length; ++i) {
- if ((temp.x < this.vec[i].x && temp.x > this.vec[i].x - 10 || temp.x > this.vec[i].x && temp.x < this.vec[i].x + 10) && (temp.y < this.vec[i].y && temp.y > this.vec[i].y - 10 || temp.y > this.vec[i].y && temp.y < this.vec[i].y + 10)) {
- return false;
- }
- }
-
- return true;
- }
-
- Location[] getLocations() {
- return this.vec;
- }
- }
-